using System;
using System.Collections.Generic;
using System.Text;
using C4F.DevKit.P2PPictureShare.PictureShareWpf.Properties;

namespace C4F.DevKit.P2PPictureShare.PictureShareWpf
{
    // Provides easy and central access to user configuration settings.
    sealed class SettingsWrapper
    {
        static Settings _settings;

        // Load settings.
        static SettingsWrapper()
        { 
            _settings = new Settings(); 
        }

        // Prevent direct instantiation.
        private SettingsWrapper()
        { }


        public static string CacheFolder
        {
            get
            { 
                return _settings.CacheFolder; 
            }
            set
            {
                if (value == null)
                { throw new ArgumentNullException("value"); }
                _settings.CacheFolder = value;
                _settings.Save();
            }
        }

        public static string ShareFolder
        {
            get
            { 
                return _settings.ShareFolder; 
            }
            set
            {
                if (value == null)
                { throw new ArgumentNullException("value"); }
                _settings.ShareFolder = value;
                _settings.Save();
            }
        }

        public static string P2PAddress
        {
            get
            { 
                return _settings.P2PAddress; 
            }
            set
            {
                if (value == null)
                { throw new ArgumentNullException("value"); }
                _settings.P2PAddress = value;
                _settings.Save();
            }
        }

        public static string P2PPassword
        {
            get
            { 
                return _settings.P2PPassword; 
            }
            set
            {
                if (value == null)
                { throw new ArgumentNullException("value"); }
                _settings.P2PPassword = value;
                _settings.Save();
            }
        }

        public static uint MaxPictureSize
        {
            get
            { 
                return _settings.MaxPictureSize; 
            }
            set
            {
                _settings.MaxPictureSize = value;
                _settings.Save();
            }
        }
    }
}
